import matplotlib.pyplot as plt
from sklearn.decomposition import PCA
from sklearn.preprocessing import StandardScaler
from sklearn.impute import SimpleImputer
import pandas as pd
import numpy as np

# 导入数据
data = pd.read_csv(r"C:\Users\Lenovo\Desktop\Insightful & Vast USA Statistics\每个UID的负债指数.csv")

# 拆分表格
DataList = list(data.groupby(['state']))
# print(DataList)

for IN_DATA in DataList:
   IN_DATA[1].to_excel(r'C:\Users\Lenovo\Desktop\Insightful & Vast USA Statistics\根据state拆分的表格\\' + str(IN_DATA[0])+ '.xlsx', sheet_name=IN_DATA[0], index=False)


